package application.Mediatiors
{
	import application.BallFacade;
	import application.Proxies.ScoreWritePxy;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	
	import gameStream.state.BallGameStream;
	
	public class GameStreamMed
	{
		
		// has mediator been initialized.
		private var _initialized:Boolean 
		private var _gs:BallGameStream;
		
		public var data:ScoreWritePxy;
		
		public function GameStreamMed()
		{
		}
		
		public function set viewPort(vp:DisplayObjectContainer):void
		{
			_gs = new BallGameStream(vp);
			_initialized = true;	
			_gs.handleBallClickFunc = handleScore;
		}
		
		private function handleScore():void
		{
			data.score++;	
			
		}
		
		public function startStream():void
		{
			if (_initialized)
			{
				_gs.start();	
			}
			else throw new Error("not initialized");
			
		}
		
		public function pauseStream():void
		{
			_gs.stop();
		}
		
		public function resumeStream():void
		{
			_gs.start();
		}
		
	}
}